﻿// 项目：	Cms.Data - Cms
// 文件名：	UnitOfWork.cs
// 
// 修改时间：2013-03-02 18:41
// 修改人：	Cooclsee

namespace Guan.CMS.Data.Infrastructure
{
    public class UnitOfWork : IUnitOfWork
    {
        private readonly IDatabaseFactory _databaseFactory;
        private CmsDataContext _dataContext;

        public UnitOfWork(IDatabaseFactory databaseFactory)
        {
            this._databaseFactory = databaseFactory;
        }

        protected CmsDataContext DataContext
        {
            get { return this._dataContext ?? (this._dataContext = this._databaseFactory.Get()); }
        }

        public void Commit()
        {
            this.DataContext.Commit();
        }
    }
}